<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@page import="com.po.*"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>我的购物车</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="assets/css/base.css">
    <link rel="stylesheet" href="assets/css/common.css">
    <link rel="stylesheet" href="assets/css/car.css">
    <link rel="stylesheet" href="assets/css/animate.css">
	<link rel="stylesheet" href="assets/css/fontawesome.min.css">
	<link rel="stylesheet" href="assets/css/bootstrap.min.css">
	<link rel="stylesheet" href="assets/css/metisMenu.css">
	<link rel="stylesheet" href="assets/css/swiper.min.css">
	<link rel="stylesheet" href="assets/css/magnific-popup.css">
	<link rel="stylesheet" href="assets/css/odometer.css">
	<link rel="stylesheet" href="assets/css/spacing.css">
	<link rel="stylesheet" href="assets/css/main.css">
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/car.js"></script>
</head>

<body>
 <header class="header-area header-style-3">
	<div class="header-top">
		<div class="container-fluid">
			<div class="row align-items-center">
				<div class="col-xl-3 col-lg-3 col-md-4 col-6">
					<div class="">
						<a href="index.jsp">
							<img src="assets/img/logo.png" alt="logo">
						</a>
					</div>
				</div>
				<div class="col-xl-6 d-none d-xl-block">
					<nav class="main-menu">
						<ul>
							<li class="">
								<a href="index.jsp">首页</a>
							</li>
							<li class="has-dropdown">
								<a href="#">商品目录</a>
								<ul class="sub-menu">
									<li><a href="#">学习用品</a></li>
									<li><a href="#">电子产品</a></li>
									<li><a href="#">其他产品</a></li>
								</ul>
							</li>
							<li class="has-dropdown">
								<a href="#">卖家中心</a>
								<ul class="sub-menu">
									<li><a href="#">注册开店</a></li>
									<li><a href="product-release.jsp">发布产品</a></li>
								</ul>
							</li>
							<li><a href="#">联系客服</a></li>
							<li><a href="login.jsp">用户中心</a></li>
						</ul>
					</nav>
				</div>
				<div class="col-xl-3 col-lg-9 col-md-8 col-6 d-flex justify-content-end align-items-center">
					<div class="header-search">
						<a href="javascript:void(0);"><i class="far fa-search"></i></a>
					</div>
					<div class="attr-menu-2">
						<ul>
							<li>
								<a href="login.jsp">
									<!-- <i class="far fa-heart"></i> -->
									<i class="fa fa-user-circle"></i>
								</a>
							</li>
							<li>
								<a href="shopcart.jsp">
									<i class="far fa-shopping-cart"></i>
								</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
</header>

<section class="breadcrumb-area pt-40 pb-40" style="background-color:rgb(253, 242, 224) ;">
		<div class="container">
			<div class="row justify-content-center">
				<div class="col-lg-8 text-center">
					<div class="breadcrumb-content">
						<h3 class="title">我的购物车</h3>
						<ul>
							<li><a href="#">ShoppingCart</a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
</section>

    <div class="c-container" style="margin-top:30px">
        <div class="w container">
            <div class="cart-filter-bar">
                <em>全部商品</em>
            </div>
            <!-- 购物车主要核心区域 -->
            <div class="cart-warp">
                <!-- 头部全选模块 -->
                <div class="cart-thead" style="background: rgb(238, 238, 238);">
                    <div class="t-checkbox" style="margin-top: -4px;">
                        <input type="checkbox" name="" id="" class="checkall" > 全选
                    </div>
                    <div class="t-goods" style="margin: -4px ;margin-left: 15px;">商品</div>
                    <div class="t-price" style="margin: -4px ;margin-left: 45px;">单价</div>
                    <div class="t-num" style="margin: -4px ;margin-left: -10px;">数量</div>
                    <div class="t-sum" style="margin: -4px ;margin-left: 15px;">小计</div>
                    <div class="t-action" style="margin: -4px ;margin-left: 5px;">操作</div>
                </div>
                <!-- 商品详细模块 -->
                <%
						Cart cart = (Cart) session.getAttribute("cart");
						if ((cart == null)) {
					%>
					<tr height="100px">
						<td colspan="7" align="center">您的购物城为空</td>
					</tr>
					<%
						} else {
							HashMap<Items, Integer> itemsInCart = cart.getItemsInCart();
							Set<Items> items = itemsInCart.keySet();
							Iterator<Items> iter=items.iterator();
							while (iter.hasNext()) {
								Items item=iter.next();
					%>
                <div class="cart-item-list">
                    <div class="cart-item check-cart-item">
                        <div class="p-checkbox">
                            <input type="checkbox" name="" id="" checked class="j-checkbox">
                        </div>
                        <div class="p-goods">
                            <div class="p-img">
                                <img src="assets\img\470\<%=item.getPicture()%>" alt="" style="width:94px;height:94px;">
                            </div>
                            <div class="p-msg"><%=item.getName()%></div>
                        </div>
                        <div class="p-price">￥<%=item.getPrice()%></div>
                        <div class="p-num">
                            <div class="quantity-form">
                                <a href="javascript:;" class="decrement">-</a>
                                <input type="text" class="itxt" value="1">
                                <a href="javascript:;" class="increment">+</a>
                            </div>
                        </div>
                        <div class="p-sum">￥<%=item.getPrice()%></div>
                        <div class="p-action"><a href="javascript:;" style="color:red";>删除</a></div>
                    </div>
					<%
							}
						}
					%>
                <!-- 结算模块 -->
                <div class="cart-floatbar">
                    <div class="select-all">
                        <input type="checkbox" name="" id="" class="checkall">全选
                    </div>
                    <div class="operation">
                        <a href="javascript:;" class="clear-all" style="color:black";>清理购物车</a>
                    </div>
                    <%
						double totalPrices = cart.getTotalPrice();
					%>
                    <div class="toolbar-right">
                        <div class="amount-sum">购物车共<em>1</em>件商品</div>
                        <div class="price-sum">总价： <em>￥<%=totalPrices%></em></div>
                        <div class="btn-area"><a href="cartsubmit.jsp" style="color:white">去结算</a></div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <footer class="footer-area footer-style-3">
        <div class="footer-bottom">
            <div class="container">
                <div class="row footer-border pt-20 pb-20">
                    <div class="col-xl-6 col-lg-6 mb-md-10 mb-xs-10">
                        <div class="copyright">
                            ©2020桂工咸鸭转转团队 reserved.
                        </div>
                    </div>
                    <div class="col-xl-6 col-lg-6">
                        <div class="footer-menu">
                            <ul>
                                <li><a href="index.html">首页</a></li>
                                <li><a href="about.html">关于</a></li>
                                <li><a href="faq.html">疑问</a></li>
                                <li><a href="contact.html">联系我们</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </footer>
</body>

</html>